package util;

import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class DateChange {
	public static String sql_dateToString( Date date ) {
		/*System.out.println("DateChange->dateStr:"+date);*/
		DateFormat df=new SimpleDateFormat("yyyy-MM-dd");
		String dateStr = df.format( date );
		/*System.out.println("DateChange->dateStr:"+dateStr);*/
		return dateStr;
	}
	public static Date StringTosql_date( String dateStr ) {
		String str = dateStr;  
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");  
        java.util.Date d = null;  
        try {  
            d = format.parse(str);  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
        java.sql.Date date = new java.sql.Date(d.getTime());  
        return date;  
	}
}
